﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Coolzon.WebServer.Code.Common
{
    public class Config
    {
        public static Config Current { get; set; }

        /// <summary>
        /// 方案配置文件存放的磁盘路径
        /// </summary>
        public string SolutionStorageDirectory { get; set; }

        /// <summary>
        /// 数据源配置文件存放的磁盘路径
        /// </summary>
        public string DataSourceStorageDirectory { get; set; }

        public string LibraryStorageDirectory { get; set; }

        public static bool Load()
        {
            return true;
        }

        /// <summary>
        /// 获取方案总的方案信息存放的文件路径
        /// </summary>
        /// <returns></returns>
        public static string GetSolutionSummaryFile()
        {
            return string.Format("{0}Solutions.xml", Current.SolutionStorageDirectory);
        }

        /// <summary>
        /// 获取方案的配置文件路径
        /// </summary>
        /// <param name="solution"></param>
        /// <returns></returns>
        public static string GetSolutionDirectory(string solution)
        {
            return string.Format("{0}{1}\\", Current.SolutionStorageDirectory, solution);
        }

        /// <summary>
        /// 获取方案中的文件
        /// </summary>
        /// <param name="solution"></param>
        /// <param name="relativePath"></param>
        /// <returns></returns>
        public static string GetSolutionContentFile(string solution, string relativePath)
        {
            return string.Format("{0}{1}\\{2}", Current.SolutionStorageDirectory, solution, relativePath);
        }
    }
}